package com.ym.student.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ym.student.system.entity.SysUser;
import com.ym.student.system.entity.SysUserRole;
import com.ym.student.system.mapper.SysUserMapper;
import com.ym.student.system.service.ISysUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author ym
 * @since 2025-04-02
 */
@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements ISysUserService {


    @Override
    public SysUser findByName(String userName) {
       // 方式1：使用QueryWrapper
        QueryWrapper<SysUser> queryWrapper = new QueryWrapper<>();
       queryWrapper.eq("user_name", userName);
       return this.getOne(queryWrapper);
    }

    @Override
    public SysUser getByUserName(String userName) {
        QueryWrapper<SysUser> wrapper = new QueryWrapper<>();
        wrapper.eq("user_name", userName);
        return this.getOne(wrapper);
    }
}
